package com.wujunshen.dumpling.common.utils;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/** @author frankwoo */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class StringUtils {
  /** 去除换行 */
  private static final Pattern REPLACE_BLANK_PATTERN = Pattern.compile("\\s*|\t|\r|\n");

  /**
   * replaceBlank
   *
   * @param str {@link String}
   * @return {@link String}
   */
  public static String replaceBlank(String str) {
    String dest = "";
    if (str != null) {
      Matcher m = REPLACE_BLANK_PATTERN.matcher(str);
      dest = m.replaceAll("");
    }
    return dest;
  }
}
